﻿using System;
using System.Collections.Generic;

using System.Text;

namespace QQZiFramework.Membership
{
    /// <summary>
    /// 登录Token记录到redis中的内容
    /// </summary>
    public class TokenInfo : TokenInfo<object>
    {

    }

    /// <summary>
    /// 登录Token记录到redis中的内容
    /// </summary>
    public class TokenInfoSimple
    {

        public string Token { get; set; }

        public string AppSecret { get; set; }

        public int UserId { get; set; }

        /// <summary>
        /// 1:前台，2：后台 , 3：商户平台
        /// </summary>
        public LoginPlatfromId PlatfromId { get; set; }

        public string ExpiresAt { get; set; }


    }
    /// <summary>
    /// 登录Token记录到redis中的内容
    /// </summary>
    public class TokenInfo<T> : TokenInfoSimple
    {

        T mValues;

        /// <summary>
        /// 商家平台或者其它平台的补充内容
        /// </summary>
        public T Values
        {
            get { return mValues; }
            set
            {
                mValues = value;
                if (value != null)
                {
                    Type type = value.GetType();
                    int posVersion = type.AssemblyQualifiedName.IndexOf(", Version");
                    if (posVersion > 0)
                    {
                        ValueTypeName = type.AssemblyQualifiedName.Substring(0, posVersion);
                    }
                    else
                        ValueTypeName = type.AssemblyQualifiedName;

                }
            }
        }

        // <summary>
        /// 商家平台或者其它平台的补充内容的类型
        /// </summary>

        public string ValueTypeName { get; set; }

    }

    /// <summary>
    /// 微信用，登录通信安全相关信息
    /// </summary>
    public class WXTokenInfo
    {
        public TokenInfo Info { get; set; }
        public BaseUser User { get; set; }
    }
}
